<template>
<uni-shadow-root class="partials-text_link-text_link"><block v-if="receiveData.androidTemplate == ''">
    
    <view class="text_link" :style="'text-align:'+(receiveData.jsonData.align)+';background-color:'+(receiveData.jsonData.bgColor)" :data-link="receiveData.jsonData.linkUrl" @click="tolinkUrl">
      <block v-if="receiveData.jsonData.iconPath">
        <view class="text_link_imageContainer flexCenter">
          <image class="text_link_icon" mode="aspectFit" :src="receiveData.jsonData.iconPath"></image>
        </view>
        <view :style="' font-size:'+(receiveData.jsonData.fontSize)+'px;color:'+(receiveData.jsonData.color)" class="text_link_text flexCenter ">
          {{receiveData.jsonData.text}}
        </view>
      </block>
      <block v-else>
        <view :style="'font-size:'+(receiveData.jsonData.fontSize)+'px;color:'+(receiveData.jsonData.color)+';text-align:'+(receiveData.jsonData.align)" class="text_link_text2 flexCenter " :data-link="receiveData.jsonData.linkUrl" @click="tolinkUrl">
          <text>{{receiveData.jsonData.text}}</text>
        </view>
      </block>
    </view>
</block></uni-shadow-root>
</template>

<script>

global['__wxRoute'] = 'partials/text_link/text_link'
const app = getApp();
Component({
  properties: {
    receiveData: {
      type: JSON,
      value: 'default value',
    }
  },
  data: {
    someData: {}
  },
  ready: function () {
      console.log("=====text_link=====",this.data.receiveData)
  },
  methods: {
    tolinkUrl: function (event) {
      app.globalData.consoleFun("=====text_link组件-tolinkUrl=====",[event.currentTarget.dataset.link])
      app.globalData.linkEvent(event.currentTarget.dataset.link);
    }
  },
})
export default global['__wxComponents']['partials/text_link/text_link']
</script>
<style platform="mp-weixin">
.text_link{
  padding:16px 0 15px 20px;
  display: flex;
  flex-direction: row;
  align-items: center;
  background: #fff;
}
.text_link_imageContainer{
  height: 20px;
  width: 40px;
}
.text_link_icon{
  height: 20px;
  width: 40px;
}
.text_link_text{
   margin-left: 10px; 
}
.text_link_text2{
  width: 100%;
}
</style>